{include file="header"}
<div style="padding: 20px;">
<form class="layui-form layui-form-pane" action="">
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  <ul class="layui-tab-title">
    <li class="layui-this">基本选项</li>
    <li>模板设置</li>
    <li>SEO优化</li>
  </ul>
  <div class="layui-tab-content">
   <div class="layui-tab-item layui-show">
  <div class="layui-form-item">
    <label class="layui-form-label">上级栏目</label>
    <div class="layui-input-block">
      <select name="tid" lay-verify="required">
        <option value="0">作为顶级栏目</option>
        {foreach name=":fun_S('cate',array('open'=>1,'tid'=>0),'px desc','1000',1)" item="v" key="k"}
        <option value="{$v.id}">{$v.name}</option>
        {volist name=":fun_s('cate',array('open'=>1,'tid'=>$v['id']),'px desc',100,1)" id="vo"}
        <option value="{$vo.id}" disabled="">——{$vo.name}</option>
        {/volist}  
        {/foreach} 
      </select>
    </div>
  </div> 
  <div class="layui-form-item">
    <label class="layui-form-label">栏目名称</label>
    <div class="layui-input-block">
      <input type="text" id="chinaName"  onBlur="ConvertName()" onkeyup="this.value=this.value.replace(/[^\u4e00-\u9fa5a-zA-Z0-9\w]/g,'')" name="name" value="" required  lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">英文目录</label>
    <div class="layui-input-block">
      <input type="text" name="alias" id="fullName" required  lay-verify="required" value=""  placeholder="请输入名称" autocomplete="off" class="layui-input">
    </div>
  </div>
  
   <div class="layui-form-item">
       <div class="layui-col-md4">
      <label class="layui-form-label">封面</label>
    <div class="layui-input-block">
     <input type="text" name="pic" value="" id="upsimg" placeholder="字段pic" autocomplete="off" class="layui-input">
     </div>
     </div> 
     <div class="layui-col-md1">
     	<button type="button" class="layui-btn layui-btn-normal layui-btn-fluid" id="upimg"><i class="layui-icon">&#xe64a;</i>上传</button>
     </div>
   </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">是否显示</label>
    <div class="layui-input-block">
      <input type="radio" name="open" value="1" title="显示" checked>
      <input type="radio" name="open" value="0" title="关闭">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">允许投稿</label>
    <div class="layui-input-block">
      <input type="radio" name="tougao" value="1" title="显示" checked>
      <input type="radio" name="tougao" value="0" title="关闭">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">首页显示</label>
    <div class="layui-input-block">
      <input type="radio" name="index" value="1" title="显示" checked>
      <input type="radio" name="index" value="0" title="关闭">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">允许编辑</label>
    <div class="layui-input-block">
      <input type="radio" name="edit" value="1" title="是" checked>
      <input type="radio" name="edit" value="0" title="否">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">投稿审核</label>
    <div class="layui-input-block">
      <input type="radio" name="sh" value="1" title="通过" checked>
      <input type="radio" name="sh" value="0" title="审核">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">排序</label>
    <div class="layui-input-block">
      <input type="number"  name="px" required  lay-verify="required" value="1"  placeholder="排序" autocomplete="off" class="layui-input" style="width: 150px;">
    </div>
  </div>
  
  
  </div>
    <div class="layui-tab-item">
  <div class="layui-form-item">
    <label class="layui-form-label">模型</label>
    <div class="layui-input-block">
      <select name="model" lay-verify="required">
        <option value=""></option>
        {volist name=":fun_s('model',array(),'id desc',100,1)" id="vr"}
        <option value="{$vr.id}">{:fun_sc_p('model', array('id'=>$vr['id']), 'name')} - {$vr.title}</option>
        {/volist} 
      </select>
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">自定义显示</label>
    <div class="layui-input-block">
      <select name="xs">
        {volist name=":Model('xs')" id="or"}
        <option value="{$or.mulu}">[{$or.mulu}]{$or.name}</option>
        {/volist} 
      </select>
    </div>
  </div>
  
  
  <div class="layui-form-item">
    <label class="layui-form-label">频道模板</label>
    <div class="layui-input-block">
      <select name="category_temp" lay-verify="required">
        <option value=""></option>
        {volist name=":Model('category_temp')" id="or"}
        <option value="{$or.mulu}">[{$or.mulu}]{$or.name}</option>
        {/volist} 
      </select>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">列表模板</label>
    <div class="layui-input-block">
      <select name="list_temp" lay-verify="required">
        <option value=""></option>
        {volist name=":Model('list_temp')" id="or"}
        <option value="{$or.mulu}">[{$or.mulu}]{$or.name}</option>
        {/volist} 
      </select>
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">内容模板</label>
    <div class="layui-input-block">
      <select name="show_temp" lay-verify="required">
        <option value=""></option>
        {volist name=":Model('show_temp')" id="or"}
        <option value="{$or.mulu}">[{$or.mulu}]{$or.name}</option>
        {/volist} 
      </select>
    </div>
  </div>

    </div>
    
    <div class="layui-tab-item">
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">关键字</label>
    <div class="layui-input-block">
      <textarea name="keywords" placeholder="请输入内容" class="layui-textarea"></textarea>
    </div>
  </div>
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">描述</label>
    <div class="layui-input-block">
      <textarea name="description" placeholder="请输入内容" class="layui-textarea"></textarea>
    </div>
  </div>	
    </div>
  </div>
 
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="myucms">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>

</div>	
</form>

    <script src="*ADMIN*/js/Convert_Pinyin.js"></script>
    <script>            
        var ConvertName = function(){    
            var chinaName = $('#chinaName').val();    
            var fullName = pinyin.getFullChars(chinaName);
            $('#fullName').val(fullName);
        }
        
    </script>
     <script>
     layui.use('upload', function(){
     	var $ = layui.jquery
     	,upload = layui.upload;
     	jq = layui.jquery;
          //上传图片
          	upload.render({
			elem: '#upimg',
			url: "{:url("upimg/up")}",
			accept: 'file',
			exts: 'jpg|png|gif|bmp|jpeg',
			done: function(res) {
				if (res.code == '0') {
					jq('input[id=upsimg').val(res.data.src);
					return layer.msg(res.msg);
				} else {
					return layer.msg(res.msg);
				}
			}
		});
       });
      </script>
<script>
layui.use('form',function(){
  var form = layui.form
  ,jq = layui.jquery;
  //添加变量
  form.on('submit(myucms)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("cate/insert")}',param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
         location.reload();
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });
});
</script>
      
<div>
{include file="footer"}

